package com.cloud.thelen.wallpaper.Adapter;

import android.view.View;

import androidx.fragment.app.FragmentActivity;

import com.cloud.thelen.wallpaper.AllAdapter.BaseRecyclerAdapter;
import com.cloud.thelen.wallpaper.AllAdapter.BaseRecyclerHolder;
import com.cloud.thelen.wallpaper.Dao.Dao;
import com.cloud.thelen.wallpaper.R;

public class HistoryAdapter extends BaseRecyclerAdapter<Dao> {
    public HistoryAdapter(FragmentActivity activity) {
        super(activity, R.layout.all_item);
    }

    private View view;

    @Override
    protected void convert(BaseRecyclerHolder holder, Dao data) {
        holder.setImage(R.id.image, activity, data.getImg());
        holder.itemView.setOnClickListener(l->{
            view.setVisibility(View.VISIBLE);
        });
//        Glide.with(activity).asBitmap().load(data.getImg()).into(new CustomTarget<Bitmap>() {
//            @Override
//            public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
//                ImageView imageView = holder.itemView.findViewById(R.id.image);
//                imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
//            }
//
//            @Override
//            public void onLoadCleared(@Nullable Drawable placeholder) {
//                // this is called when imageView is cleared on lifecycle call or for some other reason.
//                // if you are referencing the bitmap somewhere else too other than this imageView
//                // clear it here as you can no longer have the bitmap
//            }
//        });
    }

    public void setView(View view) {
        this.view = view;
    }
}
